test(operator-trend): characterization net for _build_resolution_trend payload (T3-2 phase 8a)#94
Conversation
…rend assembled payload (T3-2 phase 8a) Pins the exact 388-key payload _build_resolution_trend assembles (its 1,676-line payload.update) across a 4-case corpus exercising both the falsy- and truthy-primary_target branches. Safety net for the upcoming god-function decomposition: extracting the payload-assembly seam and collapsing the per-tier blocks must reproduce this byte-for-byte. Enumerator-generated (never hand-authored); regenerate via uv run python tests/golden/enumerate_resolution_trend_contract.py
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8ebd0b05db
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| "snapshot": { | ||
| "items": {it["item_id"]: it for it in items}, | ||
| "has_attention": any(it["lane"] in ("blocked", "urgent") for it in items), | ||
| "generated_at": generated_at, | ||
| } |
There was a problem hiding this comment.
Return history fixtures in the shape the parser reads
For the cases that are supposed to exercise stale/persisting history, these entries are passed to _build_resolution_trend as history, which immediately normalizes them through _snapshot_from_history; that helper reads operator_queue, operator_summary.counts, and top-level generated_at, not a nested snapshot object. As a result each stale_history row in this golden is treated as an empty run, so the contract does not actually pin the history-depth/persisting/reopened branches it claims to protect before the refactor.
Useful? React with 👍 / 👎.
What
Adds a characterization (golden) net pinning the exact 388-key payload that
_build_resolution_trendassembles — its 1,676-linepayload.update({...})— across a 4-case input corpus.Why
_build_resolution_trendis the last 1,852-line god-function inoperator_resolution_trend.py. Its upstream stages (run-context, apply-chain, summary-context, topline-payload) are already extracted tooperator_trend_*modules and independently tested; the only un-extracted bulk is the flat payload assembly. Before decomposing it (extract the assembly seam, then collapse the 8 per-tier blocks onto a parametrized base), we need a net that pins the assembled output — the sibling goldens pin only the lower-layer classifiers/composers, not the top-level wiring.Corpus
emptysingle_blocked_stalemulti_class_attentionattention_no_historyNon-degeneracy is guarded: 107 keys diverge empty-vs-populated, 163 non-default values in the populated case.
Safety
uv run python tests/golden/enumerate_resolution_trend_contract.py.Verification
uv run pytest -q→ 2541 passed, 2 skippeduv run ruff check src/ tests/→ cleanuv run mypyon the enumerator → clean